package net.huashitong.keyan.web;

import com.sirdc.modules.core.web.JsonBaseController;
import com.sirdc.modules.core.web.model.JqGrid;
import com.sirdc.modules.sys.databean.SysUserDataBean;
import com.sirdc.modules.sys.filter.SysUserFilter;
import net.huashitong.keyan.entity.DuBanList;
import net.huashitong.keyan.entity.DubanPoJie;
import net.huashitong.keyan.entity.IndexMag;
import net.huashitong.keyan.entity.ZhengxiangJili;
import net.huashitong.keyan.filter.DubanListFilter;
import net.huashitong.keyan.filter.DubanPoJieFilter;
import net.huashitong.keyan.filter.IndexMagFilter;
import net.huashitong.keyan.filter.ZhengxiangJiliFilter;
import net.huashitong.keyan.service.DubanListService;
import net.huashitong.keyan.service.DubanPoJieService;
import net.huashitong.keyan.service.IndexMagService;
import net.huashitong.keyan.service.ZhengxiangJiliService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/task/juece/")
public class WentiHuizongCtrl extends JsonBaseController {
    @Override
    protected String getView(String s) {
        return "modules/keyan/juece/"+s;
    }

    @Autowired
    private DubanPoJieService wentiService;
    @RequestMapping(value = "/wenti",method = RequestMethod.GET)
    public String initPage() {
        return getView("dubanpoj/query");
    }


    @ResponseBody
    @RequestMapping(value = "/wenti",method = RequestMethod.POST)
    public JqGrid query(@ModelAttribute DubanPoJieFilter filter) {
        List<DubanPoJie> list = wentiService.getList(filter);
        return coverJqGrid(filter, list);
    }

    /**
     * 实时督办清单
     */
    @Autowired
    private DubanListService listService;
    @RequestMapping(value = "/qingdan",method = RequestMethod.GET)
    public String initlistPage() {
        return getView("shishiduban/query");
    }


    @ResponseBody
    @RequestMapping(value = "/qingdan",method = RequestMethod.POST)
    public JqGrid querylist(@ModelAttribute DubanListFilter filter) {
        List<DuBanList> list = listService.getList(filter);
        return coverJqGrid(filter, list);
    }

    /**
     * 指标管理
     */
    @Autowired
    private IndexMagService indexMagService;
    @RequestMapping(value = "/index",method = RequestMethod.GET)
    public String IndexInitPage() {
        return getView("IndexMag/query");
    }


    @ResponseBody
    @RequestMapping(value = "/index",method = RequestMethod.POST)
    public JqGrid queryIndex(@ModelAttribute IndexMagFilter filter) {
        List<IndexMag> list = indexMagService.getList(filter);
        return coverJqGrid(filter, list);
    }

    /***
     * 正向激励
     */
    @Autowired
    private ZhengxiangJiliService jiliService;
    @RequestMapping(value = "/jili",method = RequestMethod.GET)
    public String jiLiInitPage() {
        return getView("zhengxiang/query");
    }


    @ResponseBody
    @RequestMapping(value = "/jili",method = RequestMethod.POST)
    public JqGrid queryJili(@ModelAttribute ZhengxiangJiliFilter filter) {
        List<ZhengxiangJili> list = jiliService.getList(filter);
        return coverJqGrid(filter, list);
    }

}
